<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>

<link type="text/css" rel="stylesheet" href="../Public/css/reset.css">
<link type="text/css" rel="stylesheet" href="../Public/css/DateTimePicker.css">
<link type="text/css" rel="stylesheet" href="../Public/css/style.css">

<script type="text/javascript" src="../Public/script/jquery.js"></script>
<script type="text/javascript" src="../Public/script/distpicker.data.js"></script>
<script type="text/javascript" src="../Public/script/distpicker.js"></script>
<script type="text/javascript" src="../Public/script/DateTimePicker.js"></script>
<script type="text/javascript" src="../Public/script/jquery.SuperSlide.2.1.1.js"></script>
<script type="text/javascript" src="../Public/layer/layer.js"></script>
<style>
    .active_shop{
        background-color: #009f8f;
    }
    .btn_shop{
        width: 10%;
        height: 50px;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    .btn_click_1{

    }
    .btn_click_2{
        display: none;
    }
</style>
    <script>
        $(function() {
            $(".btn_shop").click(function () {
                var ss = $(this)
                $(".btn_shop").removeClass("active_shop")
                ss.addClass("active_shop")
            })
        })
    </script>
</head>

<body>
    
<include file="Common:header"/>
    
    <!--contain-->
    <div class="contain">
    	
        <div class="widthBlock">
        	<div class="sampleCont">
            	<div class="local">
                	<a href="{:U('Index/index')}">首页</a> &gt; <a href="{:U('Shop/index')}">商城</a> &gt; 商品详情
                </div>
                <div class="SC3">
                	<div class="img fl">
                    	<img width="400" height="292" src="Uploads/{$info.img}">
                    </div>
                    <div class="text fr" style="float:left;">
                    	<h1 style="text-align: left;text-indent: 101px">{$info.name}</h1>
                        <div class="name" style="color: red;text-indent: 101px; text-align: left;">
                      ${$info.price}
                        </div>
                        <ul class="info" style="padding: 10px 60px 30px 0px;">
                        	<li style="float: none;width: 100%">
                            	<img src="../Public/images/sample_icon01.png">{$info.huxing}
                            </li>
                            <li  style="float: none;width: 100%">
                            	<img src="../Public/images/sample_icon02.png">{$info.fengge}
                            </li>
                            <li style="float: none;width: 100%">
                            	<img src="../Public/images/sample_icon03.png">{$info.area}㎡
                            </li>
                          
                            <li class="clear"></li>
                        </ul>

          <!--                       <input type="hidden" name="goodsid" id="goodsid" value="{$info.id}">    
                    
                        <div class="btns">
                        	<a class="bg1" href="tencent://message/?uin={$info.qq}&Site=润格&Menu=yes">立即咨询</a><a class="bg2" href="javascript:;">
                            加入购物车</a><a class="bg3"  href="javascript:;" onclick="xiadan()">立即下单</a>
                        </div>-->
                        <input class="session" type="hidden" value="{$_SESSION['userr']}">
                    <!--     <a class="favour <if condition='$shangpin eq 1'>checked</if> "  href="javascript:;" data-id='{$info.id}'></a>  -->
                    </div>
                    <div class="clear"></div>
                </div>
            </div>
        </div>
        
    </div>
    <!--contain end-->
    <div style="padding-right: 5%;padding-left: 5%;">
        <div style="display: flex;flex-direction: row;border-bottom: 1px solid #D3D4D3;margin-left: 0.7%;margin-right: 0.7%">
            <div  class="btn_shop active_shop" onclick="btn_click(1)">展示商品详情</div>
 
        </div>
        <div class="btn_click_1">
            <div style="display: flex;flex-direction: column;justify-content: center;padding-top: 2%">
                {$info.intro}
            </div>
        </div>

    </div>
<include file="Common:footer"/>

<script>


function xiadan(){
    if ($('.session').val()=='') {

        layer.alert('请登录后下单',function(){

            location.href='{:U("User/login")}';
        });
       }else{
location.href='{:U("Orders/index",array("id"=>$info["id"]))}';

       }
  

}



jQuery(document).ready(function(e) {
    $(".btn_click_1").show();
	$(".favour").click(function(){
  if ($('.session').val()=='') {
    layer.alert('请登录后收藏');
  }else{




		if($(this).hasClass("checked"))
		{
			$(this).removeClass("checked");
        var id= $('.favour').attr('data-id');
            $.ajax({
                  url:'{:U("User/shoucang1")}',
                  type:'post',
                  data:{
                      shangpin:id
                  },
                  success:function(data){
                  if(data==1){

                    layer.msg('取消收藏',{time: 1000,});
                  }


                  }

            })


		}
		else
		{
			$(this).addClass("checked");
            var id= $('.favour').attr('data-id');
            $.ajax({
                  url:'{:U("User/shoucang1")}',
                  type:'post',
                  data:{
                      shangpin:id
                  },
                  success:function(data){
                  if(data==1){

                    layer.msg('收藏成功',{time: 1000,});
                  }


                  }



            })
		}}
	});
	
});
    function btn_click(i) {
        if(i==1){
            $(".btn_click_2").hide();
            $(".btn_click_1").fadeIn(1000).show();
        }else {
            $(".btn_click_1").hide();
            $(".btn_click_2").fadeIn(1000).show();

        }
    }


$(function(){
    $('.bg2').click(function(){
            
       if ($('.session').val()=='') {

        layer.alert('请登录后购买',function(){

            location.href='{:U("User/login")}';
        });
       }else{
       var id=$('#goodsid').val();

    $.ajax({
         url:'{:U("User/gw")}',
         type:'post',
         data:{
             'id':id

         },
         success:function(data){
           
            if (data==1) {

                    layer.msg('加入购物车成功',{time:1000}
                      ,function(){
                      location.replace(location.href);


                      // location.href='{:U("User/gouwu")}'
                    });
                    


             //    layer.confirm('加入购物车成功',
             // function(index)
             //   {
             //    location.href='{:U("User/gouwu")}';
             //          });


                 

            }else if(data==2){
           layer.msg('已加入购物车',{time:1000});
            }else{

                layer.alert('添加购物车失败');
            }


         }


    })
}

    })


})


</script>
     <script type="text/javascript">document.getElementById("menu2").className="curr";</script>
</body>
</html>
